<template> 	
  <div class="page">
	<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						
						<div class="layui-card-body">							
							<div class="layui-form" lay-filter="">
								
								<div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">用户ID</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="text" name="accountId" disabled="disabled"  v-model="itemData.accountId" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div> 														    
						    <div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">套餐ID</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="number" name="projectId"  disabled="disabled"  v-model="itemData.projectId" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
						    <div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">门店ID</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="number" name="verifyStoreId"  disabled="disabled"  v-model="itemData.verifyStoreId" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
						    <div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">实付金额</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="number" name="payAmount" disabled="disabled"  v-model="itemData.payAmount" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
						    <div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">创建时间</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="text" name=""  disabled="disabled"  v-model="timeData" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
						     <div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">验证状态</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="text" name=""  disabled="disabled"  v-model="verifyStatus" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
								<div class="layui-form-item">
									<div class="layui-inline">
									    <label class="layui-form-label">消费状态</label>
									    <div class="layui-input-inline" style="width: 180px;">
									        <input type="text" name=""  disabled="disabled"  v-model="status" autocomplete="off" class="layui-input a" maxlength="10">
									    </div>										   
								  </div>
								</div>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<button class="layui-btn layui-btn-normal" lay-submit lay-filter="setmyinfo" @click="confirmOk">使用</button>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>		
		<input type="hidden" id='id'/>
  </div> 
</template>
<script>

export default {	
  name: 'xforderCode',  
  data () {
    return { 
    	id:'',
    	curindex:1, //页数    	    	    	
    	itemData:{}, 
    	timeData:'',
    	verifyStatus:'',
    	status:'',
    	verifyCode:""
    }
  },
  mounted(){ 
  	var _this = this;
	  window.getdates = this.getdates;  
  },
  methods: {  	
		getdates:function(data){		
			var _this = this; 
		//	_this.id=id;
//			_this.id=$("#id").val();
			var url="/huanxinsong/consumption/checkVerifyCode"		
			this.verifyCode=data.verifyCode;
			var dates={
				verifyCode:data.verifyCode,				
			}
			//alert(JSON.stringify(dates))
			ajaxRequest(url,'GET','json',dates,function(ret,err){
				//alert(url+"///"+JSON.stringify(ret))
				  _this.itemData=ret; 
				  _this.timeData=FormatDate(ret.createAt,3);				  
				  if(ret.verifyStatus==0){
				 	  _this.verifyStatus='未验证'				 	
				  }else if(ret.verifyStatus==1){
				 	  _this.verifyStatus='验证成功'						 	
				  }else{
				 		_this.verifyStatus='暂无'			 	
				  };
				  if(ret.status==0){
				 	  _this.status='等待支付'
				  }else if(ret.status==1){
				 	  _this.status='支付成功'
				  }else if(ret.status==2){
				 	  _this.status='验证完成'
				  }else if(ret.status==3){
				 	  _this.status='取消'	  
				  };
			})			
		},
		confirmOk:function(){
			var _this=this;
			//alert(JSON.stringify(_this.itemData))
			var dates={
				 /*accountId:_this.itemData.accountId,
				 projectId:_this.itemData.projectId,
				 payAmount:_this.itemData.payAmount,
				 verifyStoreId:_this.itemData.verifyStoreId,
				 createAt:_this.itemData.createAt,
				 verifyStatus:_this.itemData.verifyStatus,
				 status:_this.itemData.status,*/
				 verifyCode:this.verifyCode
			}			
			var url="/huanxinsong/consumption/useVerifyCode"
			ajaxRequest(url, 'GET', 'JSON', dates, function(ret, err){
				//alert(JSON.stringify(dates)+"///"+JSON.stringify(ret))
				layer.msg('操作成功！');
				setTimeout(function(){
			  	var index = parent.layer.getFrameIndex(window.name);	          	
			    parent.layer.close(index);
		      parent.location.reload(); 
	      },1000)
			})
		},
//	dotime(val){
//		return FormatDate(val);
//	}
  },
   updated:function(){
		this.isShow = true;
		var _this=this;
		layui.use('form', function(){
		  var form = layui.form;
		  form.render();
		  form.on("select(status)", function(data){										
			   _this.status = data.value
		  });
		});
  },

}
</script>
<style scoped>
</style>
